#ifndef USART_H
#define USART_H

#include "stdint.h"
#include "stm32f10x_gpio.h"
#include "stm32f10x_rcc.h"
#include "stm32f10x.h"
#include "stm32f10x_usart.h"
#include "string.h"
#include "stdarg.h"
#include "stdio.h"


#define U1_RxMaxSize   256
#define U1_RxBuff_Size 2048
#define U1_TxBuff_Size 128
#define U1_Rx_Ptr_Buff_Num 12


typedef struct{
    uint8_t *start;
    uint8_t *end;
}U_RxBuff_ptr;

typedef struct{
    U_RxBuff_ptr* U_Data_IN;//接收指针;
    U_RxBuff_ptr* U_Data_OUT;//发送指针;
    U_RxBuff_ptr* U_Data_end;//接收数组末尾指针;
    uint16_t U_Data_counter;//接收数据计数;
    U_RxBuff_ptr U1_Rx_Ptr_Buff[U1_Rx_Ptr_Buff_Num];//区间对指针数组
}U_CB;

extern uint8_t U1_RxBuff[U1_RxBuff_Size];
extern U_CB U1_CB;

void USART1_Init(uint32_t bound);
void u1_printf(char *format, ...);
void U1_ptr_init();
void U1RX_DMA_Init();
void U1_ptr_init();
#endif 

